package com.letoken.platform.admin.controller;

import com.letoken.platform.admin.service.CaptchaService;
import com.letoken.platform.pub.res.ApiResponse;
import com.letoken.platform.repo.admin.res.user.CaptchaRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author xiehui
 * @version 1.0
 * @date 2023-06-27 15:03
 */

@Slf4j
@RestController
@RequestMapping("/Captcha")
@Api(tags = "验证码管理")
public class CaptchaController {




    @Autowired
    private CaptchaService captchaService;

    @ApiOperation(value = "获取计算验证码", notes = "获取计算验证码")
    @GetMapping("/captcha")
    public ApiResponse captcha() {

        CaptchaRes a = captchaService.generateCaptcha();

        return ApiResponse.create(a);
    }


    @ApiOperation(value = "验证计算验证码", notes = "验证计算验证码")
    @GetMapping("/checkCaptcha")
    public ApiResponse checkCaptcha(String uuid, String captcha) {

        Boolean falg = captchaService.checkCaptcha(uuid,captcha);

            return ApiResponse.create(falg);



    }


}
